<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var trailingZeroes = function(n) {
    var sum = 1
    for( var i = 1 ; i<=n ; i++ ){
        sum = sum*i
    }
    sum = sum.toString()
    var count = 0
    for( var i = sum.length-1 ; i>=0 ; i-- ){
        if( sum[i] === '0' ){
            count++
        }else{
            return count
        }
    }
};

var n = 7
console.log(trailingZeroes(n))
    </script>
</body>
</html>